/***************************************************************************************************

CVARS:

[prefix]_auto_buy_cost_type - speciifes if cost should be changed if user is buying items with quick
command
0 - nothing
1 - if user is buying automaticly he will pay additional money
realCost = cost + [prefix]_auto_buy_cost_val
2 - if user is buying automaticly he will pay additional % of real cost 
realCost = cost + (cost * [prefix]_auto_buy_cost_val)
----------------------------------------------------------------------------------------------------

[prefix]_auto_buy_cost_val - specifiest additional cost if user is buying items with quick command
if([prefix]_auto_buy_cost_type == 1) it is integer
if([prefix]_auto_buy_cost_type == 2) it is float
----------------------------------------------------------------------------------------------------

[prefix]_buy_time_type - specifiets rule of checking time when player can buy items
0 - buying is allowed at any time
1 - buying is allowed for mp_buytime minutes
2 - buying is allowed for [prefix]_buy_time_val seconds
----------------------------------------------------------------------------------------------------

[prefix]_buy_time_val - how many seconds for buying items
----------------------------------------------------------------------------------------------------

[prefix]_buy_place_type - specifies where player can buy items
0 - eevrywhere on map
1 - only in buy_zone
2 - only near place he spawns
----------------------------------------------------------------------------------------------------

[prefix]_buy_place_distance - in what distance from spawn point player can buy items (uesd only if 
[prefix]_buy_place_type is 2)
----------------------------------------------------------------------------------------------------

***************************************************************************************************/

/***************************************************************************************************
					CONFIGURATION
***************************************************************************************************/


//Default cevars values:
#define CVAR_AUTO_BUY_COST_TYPE_DEF "2"
#define CVAR_AUTO_BUY_COST_VAL_DEF "0.1"
#define CVAR_BUY_TIME_TYPE_DEF "2"
#define CVAR_BUY_TIME_VAL_DEF "60"
#define CVAR_BUY_PLACE_TYPE_DEF "1"
#define CVAR_BUY_PLACE_DISTANCE_DEF "100"

//--------------------------------------------------------------------------------------------------

/*
Multi language:

For each of these defines if you do not comment them, strings will be formated using multilanguage
For example:
Display prefix will be formated:
formatex(text, charsmax(text), "%L", id, disp_prefix);
or if you commnet ML_PREFIX_DISP:
formatex(text, charsmax(text), "%s", disp_prefix);
*/

// Comment line below if you do not want to have multilanguage prefix displayed in chat commands
#define ML_PREFIX_DISP

// Comment line below if you do not want to have multilanguage item names
#define ML_ITEM_NAMES

// Comment line below if you do not want to have multilanguage strings
#define ML_STRINGS
//--------------------------------------------------------------------------------------------------


// Maximum array sizes:
// Maximum number of dealers
#define MAX_DEALERS 10

// Maximum number of players on server +1
#define MAX_PLAYERS 33
//--------------------------------------------------------------------------------------------------


// This is prefix added to cvars and natives
new const prefix[] = "";
//--------------------------------------------------------------------------------------------------

// Enums:
// These are items dealer can have
enum _: Items {
	NO_ITEM	//Delete this and add your own items
}

// Strings (menu captions, chat messages
enum StringsEnum {
	sDealersMenuTitle, 	//Dealers menu title ex: "Dealers"
	sNoAccessToDealer, 	//Message displayed when player has no access to any dealer ex: "You do not have access to any dealer"
	sCount,		  	//Count string "Count"
	sCost,			//Cost string "Cost"
	sItemMenuTitle,		//Items menu title ex: "Items"
	sItemBought,		//Message displayed when player have bought item ex: "You have bought" (item name and cost will be added)
	sNotEnoughMoney,	//Message displayed when player do not have enough money for item ex: "You do not have enough money"
	sItemsSold,		//Message displayed when player wans to buy item, but dealer has sold all of them ex: "have sold all"
	sCanNotBuy		//Message displayed when player can not buy item
}

//--------------------------------------------------------------------------------------------------

// Strings:
// This is preifx displayed in chat messages
new const prefix_disp[] = "";

new const ItemNames[Items][] = {
	""
}

//--------------------------------------------------------------------------------------------------


new const Strings[StringsEnum][] = {
	"",
	"",
	"",
	"",
	"",
	"",
	"",
	"",
	""
}

#define PLUGIN "Dealer"
#define VERSION "1.0"
#define AUTHOR "Zabijaka"


#include "the_dealers\td_def.inc"
#include "the_dealers\td_main.inl"
#include "the_dealers\td_register.inl"
#include "the_dealers\td_menus.inl"
#include "the_dealers\td_tools.inl"

// Comment line below if you do not need natives for controling dealers and items from other plugins
#include "the_dealers\td_natives.inl"


public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	plugin_init_main();
	
	// Add your code here
	// ...
}

public plugin_natives(){
	#if defined _td_natives_included
	register_def_natives();
	#endif
}

public client_connect(id){
	client_connect_main(id);
}


/*	Modify this method if you want to disallow buyin some items in some condition
@params:
id - 	players id
item - 	item
returns:
true if you want to allow buying item, false othervise
*/
stock bool:td_can_give_item(id, item){
	return true;
}

/*	This method handeles buying items
For example if you have weapon dealer in this method you should give weapon
*/
stock td_item_bought(id, item){
	
}
